package org.ala.tiktools.rpc.client_server.service;

import java.util.Map;

/**
 * rpc 业务代码执行结果
 *
 * @author ala
 * @date 2025-04-07 15:18
 */
public class RpcExecuteResult {
    /**
     *  是否成功
     */
    protected boolean success;
    /**
     *  执行结果
     */
    protected Object rtn;
    /**
     * 	附加信息
     */
    protected Map<String, Object> metadata;
    /**
     *  执行期间抛出的异常
     */
    protected Throwable e;


    public static RpcExecuteResult build() {return new RpcExecuteResult();}


    public boolean isSuccess() {
        return success;
    }
    public void setSuccess(boolean success) {
        this.success = success;
    }
    public RpcExecuteResult success(boolean success) {
        setSuccess(success);
        return this;
    }

    public Object getRtn() {
        return rtn;
    }
    public void setRtn(Object rtn) {
        this.rtn = rtn;
    }
    public RpcExecuteResult rtn(Object rtn) {
        setRtn(rtn);
        return this;
    }

    public Throwable getE() {
        return e;
    }
    public void setE(Throwable e) {
        this.e = e;
    }
    public RpcExecuteResult e(Throwable e) {
        setE(e);
        return this;
    }
	public Map<String, Object> getMetadata() {
		return metadata;
	}
	public void setMetadata(Map<String, Object> metadata) {
		this.metadata = metadata;
	}
	public RpcExecuteResult metadata(Map<String, Object> metadata) {
		setMetadata(metadata);
		return this;
	}
}
